/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Mapper;

import com.sun.xml.rpc.processor.modeler.j2ee.xml.string;
import java.util.*;
import java.sql.*;

/**
 *
 * @author Quang Thao
 */
public class Book_TypeMapper  {
    
    DBMapper map;
    
    public Book_TypeMapper() throws SQLException
    {
        map = new DBMapper();
    }
    
    public List GetAll() throws Exception
    {
        List list = new ArrayList<Bean.Book_TypeBean>();
        ResultSet rs = map.ExecuteQuery("SELECT * FROM Book_Type");
        if (rs != null)
        {
            while (rs.next())
            {
                Bean.Book_TypeBean bt = new Bean.Book_TypeBean();
                bt.setID(rs.getString(1));
                bt.setName(rs.getString(2));
                bt.setStatus(rs.getString(3));
                list.add(bt);
            }
        }
        return list;
    }
    
    public Bean.Book_TypeBean GetInfo(String id) throws Exception
    {
        Bean.Book_TypeBean bt = new Bean.Book_TypeBean();
        ResultSet rs = map.ExecuteQuery("SELECT * FROM Book_Type WHERE ID='" + id + "'");
        if (rs != null && rs.next())
        {
            bt.setID(rs.getString(1));
            bt.setName(rs.getString(2));
            bt.setStatus(rs.getString(3));
        }
        return bt;
    }
}
